package com.jf3q;

import com.jf3q.front.intercept.TokenInterception;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Hello world!
 *
 */

@SpringBootApplication
@MapperScan(basePackages = {"com.jf3q.**.mapper"})
@ComponentScan(basePackages = {"com.jf3q.common","com.jf3q.security","com.jf3q.front"})
@EnableCaching
@EnableScheduling
public class FrontApp implements WebMvcConfigurer
{

    @Autowired
    TokenInterception tokenInterception;
    public static void main( String[] args )
    {
        SpringApplication.run(FrontApp.class,args);
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.
                addInterceptor(tokenInterception)
                .excludePathPatterns("/sms/**",
                        "/subject/**",
                        "/es/**",
                        "/kaptcha/**",
                        "/v3/**",
                        "/index/**",
                        "/teacher/**",
                        "/course/**",
                        "/bannerfront",
                        "/member/reg",
                        "/member/login",
                        "/webjars/**",
                        "/doc.html",
                        "/swagger-ui/**",
                        "/v3/api-docs/**",
                        "/swagger-ui.html",
                        "/alipay");
    }
}
